//
//  NetConnect.h
//  by MengXY
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "TheQueue.h"
#import "Reachability.h"
#import "HMTool.h"

typedef void(^completeblock) (id result);
typedef void(^errorblock) (id result);

typedef void(^completemainblock) (id result);
typedef void(^completesecondaryblock) (id result);
@interface NetConnect : NSObject
+ (void)connectWithUrl:(NSString *)urlStr timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
+ (void)connectWithUrl:(NSString *)urlStr param:(NSString *)param timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
// 异步上传图片
+ (void)connectUploadImageWithUrl:(NSString *)urlStr  params:(NSDictionary *)params complete:(completeblock)completeBlock error:(errorblock)errorBlock;

// 同步连接
+ (void)SynchConnectWithUrl:(NSURL *)url complete:(completeblock)completeBlock error:(errorblock)errorBlock;
+ (void)SynchConnectWithUrl:(NSString *)urlStr param:(NSString *)param timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
+ (void)SynchConnectWithUrl:(NSString *)urlStr jsonDict:(NSDictionary *)jsonDict timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
// 上传json
+ (void)connectWithUrl:(NSString *)urlStr jsonDict:(NSDictionary *)jsonDict timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;

/**
 异步GET
 */
+ (void)AsynchGetWithUrl:(NSString *)urlStr timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
/**
 异步POST json字符串
 */
+ (void)AsynchPostWithUrl:(NSString *)urlStr param:(NSString *)param timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
/**
 异步POST json字典
 */
+ (void)AsynchPostWithUrl:(NSString *)urlStr jsonDict:(NSDictionary *)jsonDict timeoutInterval:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
/**
 异步POST json字典 上传图片
 */
+ (void)AsynchPostUploadImageWithUrl:(NSString *)urlStr jsonDict:(NSDictionary *)jsonDict complete:(completeblock)completeBlock error:(errorblock)errorBlock;

+ (void)AsynchPostUploadImageWithUrl:(NSString *)urlStr jsonDict:(NSDictionary *)jsonDict timeout:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;

+ (void)AsynchDownloadPatchWithUrl:(NSString *)urlStr timeout:(NSTimeInterval)timeout complete:(completeblock)completeBlock error:(errorblock)errorBlock;
/**
 获取当前网络状态
 */
+ (BOOL) isConnectionAvailable;

singleton_h(Connect)
@end
